<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>catch</title>
</head>
<body>
    <script>
        // promise 中的 catch 方法, 跟 try...catch 不是同一个东西
        
        // catch 方法用来指定 promise 实例对象的『失败回调』

        let p = new Promise((resolve, reject) => {
            // resolve('ok');
            reject('出问题啦!!');
        });

        p.catch(v => {
            console.log(v);
        });
    </script>
</body>
</html>